def prompt
  print ">"
end   # 定义提示符

puts "You enter a dark room with two doors. Do you go through door #1 or door #2?"

prompt; door = gets.chomp
#进入哪个门接受用户输入
if door == "1"
  puts "There's a giant bear here eating a cheese cake, what do you do?"
  puts "1.Take the cake."
  puts "2.Scream at the bear."
 #如果是进入第一个的话后面又有两个选择
  prompt; bear = gets.chomp
  if bear == "1"
	puts "The bear eats your face off. Good job!"
  elsif bear == "2"#这里要注意缩进，很多地方要注意缩进，这里当然是要跟前面的if bear == "1"配对， 也就是如果bear != "1"时要执行到这里来，如果你往前推进两个空格，就不同了，这都是些细节的东西，同时， if， else, elsif后面的最好也要统一再向里面缩进两格，比如你这上面的puts， 和下面的puts，都是应该再向里缩进的。
	puts "The bear eats your legs off, Good job!"
  else 
	puts "Well, doing #{bear} is probably better, Bear runs away."
  end
#选择对应的选项会出现对应的值，如果都没有选就输出else里的内容
elsif door == "2"
  puts "You stare into the endless abyss at Cthuhlu's retina."
  puts "1. Blurberries."
  puts "2. Yellow jacket clothespins."
  puts "3. Understanding revolvers yelling melodies."
 #如果是进入第二个后面有3个选择
  prompt; insanity = gets.chomp

  if insanity == "1" or insanity == "2"
	puts "Your body survives powered by a mind of jello.Good job!"
  else
	puts "The insanity rots your eyes into a pool of muck. Good job!"
  end
#如果是选的1或2就输出XXX，如果不是就输出XXXXXX
 else
  puts "You stumble around and fall on a knife and die. Good job!"#如果没有选择这两扇门那么就输出这个里面的内容
end


#就是把if的用法层次化使用，再条件里面添加条件，考的是真值表里面的内容，只有同时满足哪些条件才会输出相对应的结果

#行吧， 这些东西你可能大概都理解了，不过要注意一点细节，就是这些elsif, else的缩进，
